:root {
  --map-legend-maxwidth: 50%;
  --map-legend-maxheight: 50%;
  --map-legend-margin: 0.75rem;
  --map-legend-font: 1rem / 1 'Arial Unicode MS Regular', sans-serif;
  /* Pane */
  --map-legend-minwidth: 177px;
  --map-legend-background: #fff;
  --map-legend-radius: 4px;
  --map-legend-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
  --map-legend-border: 1px solid #eee;
  /* Title */
  --map-legend-title-color: #444;
  --map-legend-title-size: 1rem;
  /* Components */
  --map-legend-label-size: 1rem;
  --map-legend-label-color: #aaa;
  --map-legend-thumb-height: 0.7rem;
  --map-legend-thumb-radius: 2px;
  --map-legend-line-width: 12px; /* 线长度 */
  --map-legend-bubble-stroke: #ccc;
  --map-legend-bubble-background: #f8f8f8;
  --map-legend-line-background: #444;  /* 线背景色 */
  /* Icons */
  --map-legend-symbol-size: 16px;
  --toggler-hidden-opacity: 0.5;
  --toggler-hidden-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M4.52 5.934L1.393 2.808l1.415-1.415 19.799 19.8-1.415 1.414-3.31-3.31A10.949 10.949 0 0112 21c-5.392 0-9.878-3.88-10.819-9a10.982 10.982 0 013.34-6.066zm10.237 10.238l-1.464-1.464a3 3 0 01-4.001-4.001L7.828 9.243a5 5 0 006.929 6.929zM7.974 3.76C9.221 3.27 10.58 3 12 3c5.392 0 9.878 3.88 10.819 9a10.947 10.947 0 01-2.012 4.592l-3.86-3.86a5 5 0 00-5.68-5.68L7.974 3.761z"/></svg>');
  --toggler-visible-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path fill="none" d="M0 0h24v24H0z"/><path d="M1.181 12C2.121 6.88 6.608 3 12 3c5.392 0 9.878 3.88 10.819 9-.94 5.12-5.427 9-10.819 9-5.392 0-9.878-3.88-10.819-9zM12 17a5 5 0 100-10 5 5 0 000 10zm0-2a3 3 0 110-6 3 3 0 010 6z"/></svg>');
  --legend-collapsed-up-icon: url('data:image/svg+xml,<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><rect width="48" height="48" fill="white" fill-opacity="0.01"/><path d="M13 30L25 18L37 30" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  --legend-collapsed-down-icon: url('data:image/svg+xml,<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><rect width="48" height="48" fill="white" fill-opacity="0.01"/><path d="M37 18L25 30L13 18" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg>');
}

/*  */
.mapboxgl-ctrl-legend {
  background: var(--map-legend-background);
  border-radius: var(--map-legend-radius);
  /*box-shadow: var(--map-legend-shadow);*/
  font: var(--map-legend-font);
  max-height: var(--map-legend-maxheight);
  /*max-width: var(--map-legend-maxwidth);*/
  /*min-width: var(--map-legend-minwidth);*/
  overflow: auto;
  position: relative;
  width: auto;
}

.mapboxgl-ctrl-legend .list {
  margin: var(--map-legend-margin);
}

.mapboxgl-ctrl-legend .list li {
  align-items: center;
  color: var(--map-legend-label-color);
  display: flex;
  font-size: var(--map-legend-label-size);
  margin: calc(0.5 * var(--map-legend-margin)) 0;
  text-transform: uppercase;
}


.mapboxgl-ctrl-legend * {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mapboxgl-ctrl-legend:empty {
  display: none;
}

/* 单个图层的图例 */
.mapboxgl-ctrl-legend .layer-legend-item {
  width: 100%;
  overflow: hidden;
}

/* 单个图层的图例 title */
.mapboxgl-ctrl-legend .layer-legend-item .layer-legend-item-title {
  width: 100%;
  height: 32px;
  padding: 0 12px;
  line-height: 32px;
  font-size: 12px;
  color: #5D637E;
  letter-spacing: 1.12px;
  font-weight: 400;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* title 文本 */
.layer-legend-item-title .legend-item-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

/* 图例折叠 icon */
.layer-legend-item-title .toggler-collapsed {
  width: 14px;
  height: 14px;
  padding: 4px 2px 2px 4px;
}

.toggler-collapsed-arrow {
  width: 6px;
  height: 6px;
  border: 1px solid #888;
  border-left-width: 0;
  border-bottom-width: 0;
  cursor: pointer;
  transform: matrix(0.71,0.71,0.71,-0.71,0,0);  /* 下 */
  /*transform: matrix(0.71,-0.71,0.71,0.71,0,0);  !* 上 *!*/
}

.mapboxgl-ctrl-legend summary .toggler {
  background-color: currentColor;
  color: inherit;
  cursor: pointer;
  height: var(--map-legend-title-size);
  margin-left: auto;
  /*-webkit-mask-image: var(--toggler-hidden-icon);*/
  mask-image: var(--toggler-hidden-icon);
  /*-webkit-mask-size: 100%;*/
  mask-size: 100%;
  opacity: var(--toggler-hidden-opacity);
  width: var(--map-legend-title-size);
}

.mapboxgl-ctrl-legend summary .toggler--visible {
  /*-webkit-mask-image: var(--toggler-visible-icon);*/
  mask-image: var(--toggler-visible-icon);
  opacity: 1;
}

.mapboxgl-ctrl-legend .list {
  margin: var(--map-legend-margin);
}

.mapboxgl-ctrl-legend .list li {
  align-items: center;
  color: var(--map-legend-label-color);
  display: flex;
  font-size: var(--map-legend-label-size);
  margin: calc(0.5 * var(--map-legend-margin)) 0;
  text-transform: uppercase;
}

.mapboxgl-ctrl-legend .list--color li::before {
  background: var(--color);
  border-radius: var(--map-legend-thumb-radius);
  content: '';
  display: block;
  height: var(--map-legend-thumb-height);
  margin-right: calc(1 * var(--map-legend-margin));
  width: var(--map-legend-thumb-height);
}

.mapboxgl-ctrl-legend .list--icons .icon {
  height: var(--map-legend-symbol-size);
  margin-right: calc(0.5 * var(--map-legend-margin));
  width: var(--map-legend-symbol-size);
}

.mapboxgl-ctrl-legend .gradient {
  margin: var(--map-legend-margin);
}

.mapboxgl-ctrl-legend .gradient .labels {
  font-size: var(--map-legend-label-size);
  height: calc(1.5 * var(--map-legend-label-size));
  position: relative;
}

.mapboxgl-ctrl-legend .gradient .labels span {
  color: var(--map-legend-label-color);
  position: absolute;
  transform: translateX(-50%);
}

.mapboxgl-ctrl-legend .gradient .labels span:first-child {
  transform: none;
}

.mapboxgl-ctrl-legend .gradient .labels span:last-child {
  transform: translateX(-100%);
}

.mapboxgl-ctrl-legend .gradient .bar {
  background: #ccc;
  border-radius: var(--map-legend-thumb-radius);
  height: var(--map-legend-thumb-height);
}


/* 套娃圆半径尺寸 */
.mapboxgl-ctrl-legend .bubbles {
  color: var(--map-legend-label-color);
  font-size: var(--map-legend-label-size);
  margin: var(--map-legend-margin) calc(2 * var(--map-legend-margin));
  position: relative;
}

.mapboxgl-ctrl-legend .bubbles li {
  left: 50%;
  text-align: center;
}

.mapboxgl-ctrl-legend .bubbles li + li {
  bottom: 0;
  left: 0;
  position: absolute;
  width: 100%;
}

.mapboxgl-ctrl-legend .bubbles li span {
  border-bottom: 1px solid var(--map-legend-bubble-stroke);
  bottom: 100%;
  left: 0;
  margin-bottom: -1px;
  padding-bottom: 2px;
  position: absolute;
  text-align: left;
  width: 50%;
}

.mapboxgl-ctrl-legend .bubbles li:nth-child(2n+1) span {
  left: 50%;
  text-align: right;
}

.mapboxgl-ctrl-legend .bubbles li::before {
  background: var(--map-legend-bubble-background);
  border: 1px solid var(--map-legend-bubble-stroke);
  border-radius: 50%;
  content: '';
  display: inline-block;
  height: calc(2 * var(--radius));
  width: calc(2 * var(--radius));
}


/* 列表圆半径尺寸 */
.mapboxgl-ctrl-legend .list--bubbles li::before {
  background: var(--map-legend-bubble-background);
  border: 1px solid var(--map-legend-bubble-stroke);
  border-radius: 50%;
  content: '';
  display: inline-block;
  height: calc(2 * var(--radius));
  margin-right: calc(1 * var(--map-legend-margin));
  width: calc(2 * var(--radius));
}

/* 列表圆半径尺寸 */
.mapboxgl-ctrl-legend .list--line-width li::before {
  background: var(--map-legend-line-background);
  border: 1px solid var(--map-legend-bubble-stroke);
  content: '';
  display: inline-block;
  height: var(--map-legend-line-width);
  margin-right: calc(1 * var(--map-legend-margin));
  width: var(--width);
}